<script setup>
import { ref } from 'vue'
import api from '@/api/index.js'
import Tiptap from  '@/components/TiptapEditor/Index.vue'
const content = ref('')
const handle_image_url = async (file) => {
  const formData = new FormData()
  formData.append('file', file)
  formData.append('outFileType', 'base64')
  const res = await api.upload.upload(formData)
  return new Promise((resolve, reject) => {
    resolve(res.data)
  })
}
</script>

<template>
  <div class="editor">
    <Tiptap v-model="content" :handle_image_url="handle_image_url" />
  </div>
</template>

<style scoped>
.editor {
  width: 100%;
}
</style>
